﻿using System;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
namespace com.stifel.BranchMgmt
{
    public partial class BranchMgmtUserControl
    {

        void navigateToSelectedView( Button button )
        {
            string arg = button.CommandArgument;
            int index = -1;

            for ( int i = 0; i < uiView.Views.Count; i++ )
            {
                View view = uiView.Views[ i ];
                if ( view.ID.Equals( arg, StringComparison.OrdinalIgnoreCase ) )
                {
                    index = i;
                    break;
                }
            }
            uiView.ActiveViewIndex = index >= 0 ? index : uiView.Views.Count - 1;
            foreach ( Control c in uiNavigation.Controls )
            {
                Button b = c as Button;
                if ( b != null )
                {
                    b.Attributes.Remove( Attribute.Current );
                }
            }
            button.Attributes.Add( Attribute.Current, true.ToString( ) );
        }
        class Attribute
        {
            #region Fields

            public const string Current = "current";

            #endregion Fields
        }
    }
}
